#include "easy.h"
#include "ui_easy.h"

Easy::Easy(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::Easy)
{
    ui->setupUi(this);
    setFixedSize(800,600);
}

Easy::~Easy()
{
    delete ui;
}


void Easy::on_pushButton_close_clicked()
{
    close();

}



void Easy::on_btn_test_clicked()
{
    QModelIndex index = ui->listWidget->currentIndex();
    QString text = index.data().toString();
    QString ask = ui->textEdit_ask->toPlainText();
    QString message;        //结果
    ui->textEdit_result->clear();
    if(text == "格式化Json")
    {
        if(easy->isJson(ask) == false)
        {
            message = "不是一个合法的Json";
        }
        else
        {
            message = easy->JsonParse(ask);

        }
    }
    else if(text == "QString转JsonObject")
    {

    }
    ui->textEdit_result->setText(message);
    ui->textEdit_result->repaint();

}
